package com.minsu;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

@MapperScan("com.minsu.mapper")
@SpringBootApplication
@EnableAspectJAutoProxy
public class MinsuApplication {
    public static void main(String[] args) {
        try {
            ConfigurableApplicationContext context = SpringApplication.run(MinsuApplication.class, args);

            // 添加关闭钩子
            Runtime.getRuntime().addShutdownHook(new Thread(() -> {
                if (context != null) {
                    context.close();
                }
            }));
        } catch (Exception e) {
            e.printStackTrace();
            System.exit(1);
        }
    }
}